package com.liliudong.rommath.common.base;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.core.keygen.KeyGenerators;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.FieldNameConstants;

import java.time.LocalDateTime;

/**
 * @author liliudong
 */
@EqualsAndHashCode(callSuper = true)
@Data
@FieldNameConstants
public abstract class IdBaseEntity extends BaseEntity {
    /**
     * 主键
     */
    @Id(keyType = KeyType.Generator, value = KeyGenerators.snowFlakeId)
    protected Long id;

    /**
     * 创建时间
     */
    protected LocalDateTime createdAt;

    /**
     * 创建人
     */
    protected Long createdBy;

    /**
     * 创建自部门编号
     */
    protected String createdFrom;

    /**
     * 更新时间
     */
    protected LocalDateTime updatedAt;

    /**
     * 更新人
     */
    protected Long updatedBy;

    /**
     * 逻辑删除字段 0.未删除 1.删除
     */
    @JsonIgnore
    protected Integer deleted;
}
